<template>
  <div class="search">
    <Row :gutter="16" class="all-height">
      <Col :span="showRight ? 18 : 24" class="all-height">
        <Card class="all-height card-child-height">
          <Row class="operation code-row-bg" style="display: flex; justify-content: space-between">
            <Col span="22" style="display: flex; flex-wrap: wrap">
              <Button v-has="'add'" @click="add" type="primary" icon="md-add" :loading="addBtnLoading">添加</Button>
              <Button v-has="'delete'" @click="delAll" icon="md-trash">批量删除</Button>
              <!--              <Button v-has="'other'"  @click="dropReset">重置用户密码</Button>-->
              <Button v-has="'clear'" @click="delAllMessage" icon="md-trash">清空生源数据</Button>
              <Button :loading="importing1" @click="dropExportAll">导出全部数据</Button>
              <Button v-loading="exportingSelect" @click="dropExportSelect">导出所选数据</Button>
              <!--                            <Button @click="dropImportData">导入毕业生数据</Button>-->
              <Button v-has="'input'" type="primary" icon="ios-cloud-upload-outline" @click="importFormView = true">
                导入生源信息
              </Button>
              <Button type="primary" icon="md-create" :disabled="data.length <= 0" v-show="showBatchEditButton" @click="openBatchEditPanel">
                批量修改生源信息
              </Button>

              <Modal v-model="importFormView" title="导入生源信息" class="cust-modal">
                <div class="message_border">
                  <el-alert center type="error" :closable="false">
                    说明: 当前届别为{{ distinction }}届，请确认您导入的生源数据是否为当前届别；若是其他届别，请点击页面右上角
                    年份切换对应届进行操作
                  </el-alert>
                </div>
                <Form :model="importForm">
                  <FormItem label="导入方式: ">
                    <RadioGroup v-model="importForm.importMode">
                      <Row>
                        <Radio label="1">增加记录(只增加新的记录,已存在的记录不变)</Radio>
                        <!--                                                <Radio label="4">不查重</Radio>-->
                      </Row>
                      <Row>
                        <Radio label="2">覆盖记录(只对存在的记录进行更新)</Radio>
                      </Row>
                      <Row>
                        <Radio label="3">增加+覆盖记录</Radio>
                      </Row>
                    </RadioGroup>
                  </FormItem>
                  <FormItem label="文件: ">
                    <Upload accept=".xls, .xlsx,.dbf,.zip,.rar" :before-upload="handleUpload">
                      <Button icon="ios-cloud-upload-outline">点击上传</Button>
                    </Upload>
                    <div v-if="importForm.file !== null">
                      {{ importForm.file.name }}
                    </div>
                  </FormItem>
                </Form>
                <div slot="footer">
                  <Button @click="importFormcCncel">取消</Button>
                  <Button type="primary" :loading="importing" @click="importFormOk">开始上传</Button>
                </div>
              </Modal>
              <!--              <Upload action :before-upload="beforeUploadImport" accept=".xls, .xlsx,.dbf,.zip,.rar">-->
              <!--                <Button-->
              <!--                    :loading="importing"-->
              <!--                    icon="ios-cloud-upload-outline"-->
              <!--                    style="margin-right: 10px">导入生源信息-->
              <!--                </Button>-->
              <!--              </Upload>-->
              <!--              <Progress v-if="importing" :percent="importProgress" status="active" />-->
              <Button v-has="'input'" @click="downloadTemple" type="info">下载导入模板</Button>
              <Button v-has="'input'" @click="bysCompareXj">生源比对</Button>
              <Button v-has="'input'" @click="goToHistory">导入历史</Button>
              <Button @click="knComparison">困难群体对比</Button>
              <div v-if="showDel" style="display: flex;
              align-items: center">
                <Form ref="search" :model="searchForm1" inline style="display: flex;
              align-items: center">
                  <FormItem label="高校" prop="schoolName">
                    <Input type="text" v-model="searchForm1.schoolName" clearable placeholder="高校名称"
                           style="width: 100%" @click.prevent="$event.preventDefault()"/>
                  </FormItem>
                  <FormItem label="学院" prop="collegeName">
                    <Input type="text" v-model="searchForm1.collegeName" clearable placeholder="学院名称"
                           style="width: 100%" @click.prevent="$event.preventDefault()"/>
                  </FormItem>
                </Form>
                <Button type="primary" icon="md-create" @click="delByLine">删除指定生源去向户口户档</Button>
                <Button type="primary" icon="md-create" @click="makeData">补全去向档案户口</Button>
                <Button type="primary" icon="md-create" v-loading="fakeLoading" @click="makeFakeData">假数据</Button>
              </div>
            </Col>
            <Col span="2" style="text-align: right">
              <Icon
                  color="#fff"
                  class="icon01"
                  :type="showRight ? `ios-arrow-forward` : `ios-arrow-back`"
                  @click.native="clickShowRight"
              ></Icon>
              <!--              <Button-->
              <!--                  :icon="showRight?`ios-arrow-forward`:`ios-arrow-back`"-->
              <!--                  @click.native="clickShowRight"-->
              <!--                  size="mini"-->
              <!--                  type="primary">-->
              <!--              </Button>-->
            </Col>
          </Row>
          <Row v-show="openTip">
            <div class="flex" style="width: 100%">
              <div class="flex-1">
                <Alert show-icon>
                  已选择
                  <span class="select-count">{{ selectList.length }}</span>
                  项
                  <a class="select-clear" @click="clearSelectAll">清空</a>
                  <a class="select-clear" style="cursor: pointer" @click="getDataList">刷新</a>
                </Alert>
              </div>
              <Button icon="ios-funnel" @click="getCheckShow " type="primary"></Button>
              <!--<el-button icon="el-icon-menu" size="small"  type="primary"></el-button>-->
              <!--<button @click="headerModify ">ss</button>-->
            </div>

          </Row>
          <Row class="calc-px-height">
            <div v-if="loading" class="wh-100 d-flex-around-center">
              <Spin></Spin>
            </div>
            <div v-else v-ref-height="refHeight" class="wh-100">
              <el-table
                  :v-loading="listLoading"
                  :height="refHeight.value || '100%'"
                  border
                  :columns="columns"
                  :data="data"
                  empty-text="暂无数据"
                  sortable="custom"
                  @sort-change="changeSort"
                  @selection-change="changeSelect"
                  @row-dblclick="sjclaib"
                  ref="table"
                  :key="key"
              >
                <el-table-column type="selection" width="60" align="center"></el-table-column>
                <el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
                <el-table-column v-for="column in columns" :label-class-name="column.key" :align="column.align" :key="column.key" :prop="column.key" :label="column.title" :sortable="column.sortable" :width="column.width" :min-width="column.minWidth" :fixed="column.fixed">
                  <template slot-scope="scope">
                    <div v-if="column.key == 'isActivate'">
                      <div class="wh-100">
                        <Badge v-if="scope.row.isActivate == 0" text="学校新增" status="default">学校新增</Badge>
                        <span v-else-if="scope.row.isActivate == 1" text="学生激活" status="success">学生激活</span>
                        <span v-else-if="scope.row.isActivate == 2" text="异动" status="error">异动</span>
                        <span v-else text="异常" status="error">异常</span>
                      </div>
                    </div>
                    <div v-else-if="column.key == 'sexCode'">
                      <div>{{ columnValue(scope.row[column.key], 'sexCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'mzCode'">
                      <div>{{ columnValue(scope.row[column.key], 'mzCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'zzmmCode'">
                      <div>{{ columnValue(scope.row[column.key], 'zzmmCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'cxsy'">
                      <div>{{ columnValue(scope.row[column.key], 'cxsy') }}</div>
                    </div>
                    <div v-else-if="column.key == 'xlCode'">
                      <div>{{ columnValue(scope.row[column.key], 'xlCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'xxxs'">
                      <div>{{ columnValue(scope.row[column.key], 'xxxs') }}</div>
                    </div>
                    <div v-else-if="column.key == 'pyfsCode'">
                      <div>{{ columnValue(scope.row[column.key], 'pyfsCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'sydCode'">
                      <div>{{ columnValue(scope.row[column.key], 'sydCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'xz'">
                      <div>{{ columnValue(scope.row[column.key], 'xz') }}</div>
                    </div>
                    <div v-else-if="column.key == 'sfslbCode'">
                      <div>{{ columnValue(scope.row[column.key], 'sfslbCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'knslbCode'">
                      <div>{{ columnValue(scope.row[column.key], 'knslbCode') }}</div>
                    </div>
                    <div v-else-if="column.key == 'sf52pkx'">
                      <div>{{ columnValue(scope.row[column.key], 'sf52pkx') }}</div>
                    </div>
                    <div v-else-if="column.key == 'szdq'">
                      <div>{{ columnValue(scope.row[column.key], 'szdq') }}</div>
                    </div>
                    <div v-else-if="column.key == 'knqtbj'">
                      <div>{{ columnValue(scope.row[column.key], 'knqtbj') }}</div>
                    </div>
                    <div v-else-if="column.key == 'action'">
                      <div>
                        <a :style="{display: handlePermission('edit') ? 'inline-block' : 'none'}" @click="edit(scope.row)">编辑</a>
                        <Divider type="vertical" />
                        <a :style="{display: handlePermission('delete') ? 'inline-block' : 'none'}" @click="remove(scope.row)">删除</a>
                      </div>
                    </div>
                    <div v-else>{{ scope.row[column.key] }}</div>
                  </template>
                </el-table-column>
              </el-table>
              <!-- no-filtered-data-text="暂无数据" -->
              <!-- <div v-else class="wh-100">
                <NoData class="wh-100"></NoData>
              </div> -->
            </div>
          </Row>
          <Row type="flex" justify="end" class="page">
            <Page
                :current="searchForm.pageNumber"
                :total="total"
                :page-size="searchForm.pageSize"
                @on-change="changePage"
                @on-page-size-change="changePageSize"
                :page-size-opts="[10, 20, 50, 100, 200]"
                size="small"
                show-total
                show-elevator
                show-sizer
            ></Page>
          </Row>
        </Card>
      </Col>
      <Col span="6" class="all-height" v-show="showRight">
        <Card class="all-height card-child-height">
          <Row v-show="!openSearch" @keydown.enter.native="handleSearch">
            <Col span="24">
              <div class="drawer-header">
                <div class="cmr16">查询区</div>
              </div>
            </Col>
            <Col span="24">
              <Form ref="searchForm" :model="searchForm" :label-width="quryLabelWidth">
                <FormItem label="姓名" prop="name">
                  <Input type="text" v-model="searchForm.name" clearable placeholder="请输入姓名" style="width: 100%"
                         @click.prevent="$event.preventDefault()"/>
                </FormItem>
                <FormItem label="身份证号" prop="idCard">
                  <Input type="text" v-model="searchForm.idCard" placeholder="请输入身份证号" clearable
                         style="width: 100%"/>
                </FormItem>
                <FormItem label="考生号" prop="ksh">
                  <Input type="text" v-model="searchForm.ksh" placeholder="请输入考生号" clearable style="width: 100%"/>
                </FormItem>
                <FormItem label="学号" prop="xh">
                  <Input type="text" v-model="searchForm.xh" placeholder="请输入学号" clearable style="width: 100%"/>
                </FormItem>
                <FormItem label="专业" prop="zy">
                  <Select v-model.lazy="searchForm.zy" style="width: 92%" clearable  filterable
                          @on-create="getMajor($event)">
                    <Option v-for="(item,index) in MajorOptions" :value="item" :key="index">{{ item }}</Option>
                  </Select>
                </FormItem>
                <FormItem label="学历" prop="xlCode">
                  <Select v-model.lazy="searchForm.xlCode" style="width: 92%" clearable filterable>
                    <Option v-for="item in xlList" :value="item.value" :key="item.value">{{ item.title }}</Option>
                  </Select>
                </FormItem>
                <FormItem label="手机号码" prop="mobile">
                  <Input type="text" v-model="searchForm.mobile" placeholder="请输入手机号码" clearable
                         style="width: 100%"/>
                </FormItem>
                <FormItem label="所在班级" prop="mobile">
                  <Input type="text" v-model="searchForm.szbj" placeholder="请输入班级名称" clearable
                         style="width: 100%"/>
                </FormItem>

                <span v-if="drop">
                                    <FormItem v-if='resource === "1" || resource === "0"' label="高校代码"
                                              prop="gxcode">
                                        <Input type="text" v-model="searchForm.gxcode" placeholder="请输入高校代码"
                                               clearable style="width: 100%"/>
                                    </FormItem>
                                    <FormItem v-if='resource === "1" || resource === "0"' label="高校名称" prop="gxmc">
                                        <Input type="text" v-model="searchForm.gxmc" placeholder="请输入高校名称"
                                               clearable style="width: 100%"/>
                                    </FormItem>
                                    <FormItem v-if='resource === "2"' label="所在院系" prop="yxmc">
                                        <Select v-model="searchForm.yxmc" style="width: 92%" clearable filterable>
                                            <Option v-for="(item,index) in yxmcList"  :value="item.yxname" :key="index">{{ item.yxname }}</Option>
                                        </Select>
                                    </FormItem>
                                </span>
                <FormItem label="困难群体标记" >
                  <Select v-model="searchForm.knqtbj" style="width: 92%" clearable filterable>
                    <Option :value="0" >否</Option>
                    <Option :value="1" >是</Option>
                  </Select>
                </FormItem>
                <FormItem class="br box-key">
                  <Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
                  <Button @click="handleReset">重置</Button>
                </FormItem>
              </Form>
            </Col>
          </Row>
          <Row class="calc-sm-height" v-show="openSearch">
            <addEdit :data-row="form" ref="addOrEdit" :type="showType" :value="showValue" v-model="showUser"
                     @on-submit="getDataList" @open-search="changeOpenSearch"
                     :addOrEditLabelWidth="addOrEditLabelWidth"/>
          </Row>
        </Card>
      </Col>
    </Row>

    <!--        下面这个抽屉应该没有被用到-->
    <Drawer title="导入数据" v-model="importModalVisible" class="c-drawer01">
      <div style="display: flex; justify-content: space-between; align-items: center">
        <Upload action :before-upload="beforeUploadImport" accept=".xls, .xlsx,.dbf,.zip,.rar">
          <Button :loading="reading" icon="ios-cloud-upload-outline" style="margin-right: 10px">
            上传Excel文件
          </Button>
          <span v-if="uploadfile.name">当前选择文件：{{ uploadfile.name }}</span>
        </Upload>
        <!--        <Button @click="clearImportData" icon="md-trash">清空数据</Button>-->
      </div>
      <Alert type="warning" show-icon>
        导入前请下载查看导入模版数据文件查看所需字段及说明，确保数据格式正确，不得修改列英文名称
      </Alert>
      <Table :columns="importColumns" border :height="height" :data="importTableData" ref="importTable"></Table>
      <div class="drawer-footer">
        <Button @click="downloadTemple" type="info">下载导入模板</Button>
        <div style="position: absolute; right: 15px; display: inline-block">
          <Button @click="importModalVisible = false">关闭</Button>
          <!--          <Button-->
          <!--              :loading="importLoading"-->
          <!--              :disabled="importTableData.length <= 0"-->
          <!--              @click="importData"-->
          <!--              style="margin-left: 8px"-->
          <!--              type="primary"-->
          <!--          >-->
          <!--            确认导入-->
          <!--            <span v-if="importTableData.length > 0"-->
          <!--            >{{ importTableData.length }} 条数据</span-->
          <!--            >-->
          <!--          </Button>-->
        </div>
      </div>
    </Drawer>

    <!--        数据批量修改-->
    <Drawer class="cust-drawer" title="批量修改生源数据" :mask-closable="false" :closable="true"
            v-model="showBatchEditDrawer">
      <!--            头部高度45px 底部高度30px-->
      <div class="d-flex left-box">
        <Row>
          <Col span="10">
            <Input v-model="batchEditInput" type="textarea" :rows="43" placeholder="此处粘贴身份证"/>
          </Col>
          <Col span="14">
            <div class="batch-edit">
              <batchEdit ref="batchEditRef"
                         :addOrEditLabelWidth="addOrEditLabelWidth"
              />
            </div>
          </Col>
        </Row>
      </div>
      <div class="footer">
        <div class="d-flex-align-center f-wrapper">
          <Button @click="$refs.batchEditRef.resetForm()">重置</Button>
          <Button
              @click="
                            showBatchEditDrawer = false;
                            batchEditInput = '';
                        "
          >
            取消
          </Button>
          <Button type="primary" @click="batchEditSubmit">确定修改</Button>
        </div>
      </div>
    </Drawer>
    <!--        数据批量修改确认页面-->
    <Modal v-model="batchEditConfirmModal" title="确认修改" @on-ok="batchEditPost">
      <div>检查出错的身份证有：{{
          batchEditErrorIds && batchEditErrorIds.length > 0 ? batchEditErrorIds.join(',') : '无'
        }}
      </div>
      <div>检查正确的身份证数量：{{ batchEditSuccessIds.length }}</div>
      <div>
        以下信息将被修改：
        <Table
            :columns="[
                        {
                            title: '字段',
                            key: 'name'
                        },
                        {
                            title: '修改为',
                            key: 'value'
                        }
                    ]"
            :data="batchEditDesc"
        ></Table>
      </div>
    </Modal>
    <check-password ref="checkPass" @on-success="resetPass"/>
    <!--    <el-dialog :visible.sync="importPromptVisible" :before-close="handleDialogClose" width="60%" center-->
    <!--               :close-on-press-escape="false" :close-on-click-modal="false">-->
    <!--      <div slot="title" style="display: flex">-->
    <!--        <div style="flex: 1"></div>-->
    <!--        <div style="flex: 1">导入状态提示</div>-->
    <!--        <div style="flex: 1; display: flex; justify-content: right; align-items: center">-->
    <!--          <Button @click="handleExportErrData" v-show="type === 'error'" type="info" style="margin-right: 20px">-->
    <!--            下载错误信息-->
    <!--          </Button>-->
    <!--        </div>-->
    <!--      </div>-->
    <!--      <div class="fs-16 d-flex d-flex-around-center">-->
    <!--        <div v-if="type === 'success'" class="tableStyle ">-->
    <!--          <div class="d-flex-around-center">-->
    <!--            <div class="d-flex-align-center">-->
    <!--              <Icon type="md-checkmark-circle" color="#67C23A" size="16px"/>-->
    <!--              <div class='fs-16 d-flex d-flex-around-center'>-->
    <!--                <span style="color: #67c23a">{{ tipMessage }}</span>-->
    <!--                <span style="color: #67c23a">{{ tipMessage_2 }}</span>-->
    <!--              </div>-->
    <!--            </div>-->
    <!--          </div>-->
    <!--          <div v-if="importErrorData.length > 0" class="overflow-auto-hidden " style="height: 300px">-->
    <!--            <Table :columns="importErrorCol" :data="importErrorData"></Table>-->
    <!--          </div>-->
    <!--        </div>-->
    <!--      </div>-->
    <!--    </el-dialog>-->

    <el-dialog :visible.sync="importPromptVisible" :before-close="handleDialogClose" width="60%" center
               :close-on-press-escape="false" :close-on-click-modal="false">
      <div slot="title" style="display: flex">
        <div style="flex: 1"><span class="fs-20">信息提示</span></div>
      </div>
      <div v-if="type === 'success'">
        <div style="text-align: center">
          <Icon color="#67C23A" size="16px"/>
          <div class='fs-16'>
            <a @click="goToHistoryAndCloseView">{{ tipMessage }}</a>
          </div>
        </div>
      </div>
    </el-dialog>
    <!--<el-dialog :visible.sync="checkboxShow" :before-close="checkboxShow = false" width="60%" center-->
    <!--           :close-on-press-escape="false" :close-on-click-modal="false">-->
    <!--  <div slot="title" style="display: flex">-->
    <!--    <div style="flex: 1"><span class="fs-20">展示字段</span></div>-->
    <!--  </div>-->
    <!--  <div>-->
    <!--    <el-checkbox-group v-model="checkboxVal">-->
    <!--      <el-checkbox v-for="item in formTheadOptions" :label="item">{{item  }}</el-checkbox>-->
    <!--    </el-checkbox-group> -->
    <!--  </div>-->
    <!--  &lt;!&ndash;<div slot="footer" class="dialog-footer">&ndash;&gt;-->
    <!--  &lt;!&ndash;  <el-button @click="checkboxShow = false">取 消</el-button>&ndash;&gt;-->
    <!--  &lt;!&ndash;  <el-button type="primary" @click="headerModify">确 定</el-button>&ndash;&gt;-->
    <!--  &lt;!&ndash;</div>&ndash;&gt;-->
    <!--</el-dialog>-->

    <el-dialog
        :visible.sync="checkboxShow"
        width="60%" >
      <div slot="title" style="display: flex">
        <div style="flex: 1"><span class="fs-20">展示字段</span></div>
      </div>
      <div>
        <div >
          <el-checkbox v-model="checked" @change="allChange">全选</el-checkbox>
          <el-checkbox v-model="inverted" @change="invertedChange">反选</el-checkbox>
        </div>
        <el-divider></el-divider>
        <el-checkbox-group v-model="checkboxVal" @change="allChanged">
          <el-checkbox v-for="item in formTheadOptions" :label="item">{{item  }}</el-checkbox>
        </el-checkbox-group>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="checkboxShow = false">取 消</el-button>
        <el-button type="primary" @click="headerModify">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { getAllXldmzdList, getJtlxrgx,getQzkzksbzList } from '@/api/bys/code/xldm.js';
import {getByXlAndLevel} from '@/api/bys/code.js';
import {
  getBysPersonInfoList,
  enableBysPersonInfo,
  disableBysPersonInfo,
  deleteBysPersonInfo,
  deleteAllBysPersonInfo,
  importBysData,
  easyExcelImportData,
  exportAllPersonInfo,
  schoolDoOnce,
  bysPeronInfoDoneExportByIds,
  getPeronZyApi
} from '@/api/bys/personInfo/bys.js';
import {resetUserPass, getDictDataByType, doOnce} from '@/api/index';
import departmentChoose from '@/views/my-components/xboot/department-choose';
import checkPassword from '@/views/my-components/xboot/check-password';
import {shortcuts} from '@/libs/shortcuts';
import addEdit from './addEditBys.vue';
import batchEdit from './batchEdit.vue';
// import addEdit from "./addEditBys.vue";
import excel from '@/libs/excel';
import dict from '@/views/my-components/xboot/dict';
import {fastKey} from 'core-js/internals/internal-metadata';
import {exportAllBysXjInfo} from '@/api/bys/xj/bysXjInfo';
import XLSX from 'xlsx';
import Cookies from 'js-cookie';
import {acquireMajorApi} from '../../../api/bys/personInfo/bys';
import {getAllYxManageList} from '../../../api/bys/yx/yx';
import {archiveTransferDoneExportByIds} from '@/api/archivesManagement/archiveForwardingAddressApis';
import NoData from '@/components/NoData.vue';
import { compareKnqt } from '@/api/bys/jyqx/jyqx';
export default {
  name: 'user-manage',
  components: {
    departmentChoose,
    checkPassword,
    addEdit,
    NoData,
    dict,
    batchEdit
  },
  data() {
    return {
      inverted:false,
      checked:false,
      key:0,
      addBtnLoading: true,
      listLoading: true,
      showBatchEditButtonDisabled: true,
      addOrEditLabelWidth: 90,
      quryLabelWidth: 80,
      resource: '',
      exportingSelect: false,
      showDel: false,
      distinction: sessionStorage.distinction, //届别
      editTimeout: null, //存储定时器
      immediate: true, //存储函数是否可以立即执行的标志
      type: 'success',
      tipMessage: '',
      tipMessage_2: '\t',
      importPromptVisible: false,
      importing: false,
      importing1: false,
      importProgress: 0,
      areaCodeList: [],
      yxList: [],
      height: 510,
      refHeight: {value: 0},
      showUser: false,
      showValue: false,
      showType: '0',
      openSearch: false,
      openTip: true,
      loading: true,
      reading: false,
      importLoading: false,
      drop: true,
      importModalVisible: false,
      dropDownContent: '展开',
      dropDownIcon: 'ios-arrow-down',
      selectList: [],
      height1: 0,
      searchForm1: {
        schoolName: '',
        collegeName: ''
      },
      searchForm: {
        id: '',
        name: '',
        idCard: '',
        mobile: '',
        email: '',
        status: '',
        pageNumber: 1,
        pageSize: 50,
        sort: 'createTime',
        order: 'desc',
        startDate: '',
        endDate: '',
        gxcode: '',
        gxmc: '',
        yxmc: '',
        zy: '',
        ksh: '',
        xh: '',
        szbj: '',
      },
      selectDate: null,
      options: {
        shortcuts: shortcuts
      },
      form: {},
      columns_1: Object.freeze([
        // {
        //   type: 'selection',
        //   width: 60,
        //   align: 'center'
        // },
        // {
        //   type: 'index',
        //   title: '序号',
        //   width: 60,
        //   align: 'center'
        // },
        {
          title: '姓名',
          key: 'name',
          minWidth: 100,
          sortable: true
        },

        {
          title: '届别',
          key: 'jb',
          minWidth: 80,
          sortable: false
        },
        {
          title: '院校名称',
          key: 'gxmc',
          minWidth: 150,
          sortable: false,
        },
        {
          title: '院校代码',
          key: 'gxcode',
          minWidth: 130,
          sortable: false,
        },
        {
          title: '院系名称',
          key: 'yxmc',
          minWidth: 120,
          sortable: false
        },
        {
          title: '考生号',
          key: 'ksh',
          minWidth: 140,
          sortable: false
        },
        {
          title: '学号',
          key: 'xh',
          minWidth: 140,
          sortable: false
        },
        {
          title: '身份证号',
          key: 'idCard',
          minWidth: 180,
          sortable: true
        },
        {
          title: '性别',
          key: 'sexCode',
          minWidth: 80,
          sortable: false,
          // render: (h, params) => {
          //   let dict = this.sexList.find(item => item.value == params.row.sexCode);
          //   return h('div', dict ? dict.title : '');
          // }
        },
        {
          title: '民族',
          key: 'mzCode',
          minWidth: 100,
          sortable: false,
          // render: (h, params) => {
          //   let dict = this.mzList.find(item => item.value == params.row.mzCode);
          //   return h('div', dict ? dict.title : '');
          // }
        },
        {
          title: '政治面貌',
          key: 'zzmmCode',
          minWidth: 100,
          sortable: false,
          // render: (h, params) => {
          //   let dict = this.zzmmList.find(item => item.value == params.row.zzmmCode);
          //   return h('div', dict ? dict.title : '');
          // }
        },
        {
          title: '城乡生源',
          key: 'cxsy',
          minWidth: 100,
          sortable: false,
          render: (h, params) => {
            let dict = this.cxsyList.find(item => item.value == params.row.cxsy);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: '学历',
          key: 'xlCode',
          minWidth: 100,
          sortable: false,
          render: (h, params) => {
            let dict = this.xlList.find(item => item.value == params.row.xlCode);
            return h('div', dict ? dict.title : '');
          }
        },

        {
          title: '专业',
          key: 'zy',
          minWidth: 160,
          sortable: false
        },
        {
          title: '专业方向',
          key: 'zyfx',
          minWidth: 120,
          sortable: false
        },
        {
          title: '学习形式',
          key: 'xxxs',
          minWidth: 100,
          sortable: false,
          render: (h, params) => {
            let dict = this.xxxsList.find(item => item.value == params.row.xxxs);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: '培养方式',
          key: 'pyfsCode',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            let dict = this.pyfsList.find(item => item.value === params.row.pyfsCode);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: "定向或委培单位",
          key: "dxwpdw",
          minWidth: 120,
          sortable: false,
        },
        {
          title: '生源所在地',
          key: 'sydCode',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            let dict = this.areaCodeList.find(item => item.value === params.row.sydCode);
            return h('div', dict ? dict.title : '');
          }
        },
        // {
        //   title: "城乡生源",
        //   key: "cxsy",
        //   minWidth: 120,
        //   sortable: false,
        // },
        {
          title: '学制',
          key: 'xz',
          minWidth: 80,
          sortable: false,
          render: (h, params) => {
            let dict = this.xzList.find(item => item.value == params.row.xz);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: '入学时间',
          key: 'rxsj',
          minWidth: 80,
          sortable: false
        },
        {
          title: '毕业时间',
          key: 'bysj',
          minWidth: 80,
          sortable: false
        },
        {
          title: '师范生类别',
          key: 'sfslbCode',
          minWidth: 120,
          sortable: false,
          // render: (h, params) => {
          //   let dict = this.sfslbList.find(item => item.value == params.row.sfslbCode);
          //   return h('div', dict ? dict.title : '');
          // }
        },
        {
          title: '困难生类别',
          key: 'knslbCode',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            let dict = this.knslbList.find(item => item.value == params.row.knslbCode);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: '所在班级',
          key: 'szbj',
          minWidth: 120,
          sortable: false
        },
        {
          title: '分校名称',
          key: 'fxmc',
          minWidth: 120,
          sortable: false
        },
        {
          title: '是否52贫困县',
          key: 'sf52pkx',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            if (params.row.sf52pkx == '0') {
              return h('div', '是');
            }
            if (params.row.sf52pkx == '1') {
              return h('div', '否');
            }
            return h('div', '');
          }
        },
        {
          title: '贫困县所在省',
          key: 'sheng',
          minWidth: 120,
          sortable: false
        },
        {
          title: '贫困县所在市',
          key: 'shi',
          minWidth: 120,
          sortable: false
        },
        {
          title: '出生日期',
          key: 'cssj',
          minWidth: 120,
          sortable: false
        },
        {
          title: '手机号码',
          key: 'mobile',
          minWidth: 120,
          sortable: false
        },
        {
          title: '电子邮箱',
          key: 'email',
          minWidth: 160,
          sortable: false
        },
        {
          title: 'QQ号码',
          key: 'qq',
          minWidth: 120,
          sortable: false
        },
        {
          title: '所在地区',
          key: 'szdq',
          minWidth: 160,
          sortable: false,
          render: (h, params) => {
            let dict = this.areaCodeList.find(item => item.value === params.row.szdq);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: '家庭地址',
          key: 'jtdz',
          minWidth: 160,
          sortable: false
        },
        {
          title: '家庭电话',
          key: 'jtdh',
          minWidth: 120,
          sortable: false
        },
        {
          title: '家庭邮编',
          key: 'jtyb',
          minWidth: 120,
          sortable: false
        },
        {
          title: '高职扩招',
          key: 'gzkzksbz',
          minWidth: 120,
          sortable: false
        },
        {
          title: '家庭联系人',
          key: 'familyContact',
          minWidth: 120,
          sortable: false
        },
        {
          title: '入学前档案所在单位',
          key: 'rxqdaszdw',
          minWidth: 120,
          sortable: false
        },
        {
          title: '档案是否转入学校',
          key: 'dasfzrxx',
          minWidth: 120,
          sortable: false
        },
        {
          title: '入学前户口所在地派出所',
          key: 'rxqhkszdpcs',
          minWidth: 120,
          sortable: false
        },
        {
          title: '户口是否转入学校',
          key: 'hksfzrxx',
          minWidth: 120,
          sortable: false
        },
        {
          title: '困难群体标记',
          key: 'knqtbj',
          minWidth: 120,
          sortable: false,
          // render: (h, params) => {
          //     if (params.row.knqtbj == '1') {
          //         return h('div', '是');
          //     }
          //     if (params.row.knqtbj == '0') {
          //         return h('div', '否');
          //     }
          //     return h('div', '');
          // }
        },
        {
          title: '扩展字段1',
          key: 'kzzd1',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段2',
          key: 'kzzd2',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段3',
          key: 'kzzd3',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段4',
          key: 'kzzd4',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段5',
          key: 'kzzd5',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段6',
          key: 'kzzd6',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段7',
          key: 'kzzd7',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段8',
          key: 'kzzd8',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段9',
          key: 'kzzd9',
          minWidth: 120,
          sortable: false
        },
        {
          title: '扩展字段10',
          key: 'kzzd10',
          minWidth: 120,
          sortable: false
        },
        {
          title: '创建时间',
          key: 'createTime',
          sortable: true,
          sortType: 'desc',
          minWidth: 160
        },
        {
          title: '状态',
          key: 'isActivate',
          align: 'center',
          minWidth: 150,
          fixed: 'right',
          // render: (h, params) => {
          //   if (params.row.isActivate == 0) {
          //     return h('div', [
          //       h('Badge', {
          //         props: {
          //           status: 'default',
          //           text: '学校新增'
          //         }
          //       })
          //     ]);
          //   } else if (params.row.isActivate == 1) {
          //     return h('div', [
          //       h('Badge', {
          //         props: {
          //           status: 'success',
          //           text: '学生激活'
          //         }
          //       })
          //     ]);
          //   } else if (params.row.isActivate == 2) {
          //     return h('div', [
          //       h('Badge', {
          //         props: {
          //           status: 'error',
          //           text: '异动'
          //         }
          //       })
          //     ]);
          //   } else {
          //     return h('div', [
          //       h('Badge', {
          //         props: {
          //           status: 'error',
          //           text: '异常'
          //         }
          //       })
          //     ]);
          //   }
          // }
        },
        {
          title: '操作',
          key: 'action',
          width: 150,
          align: 'center',
          fixed: 'right',
          // render: (h, params) => {
          //   return h('div', [
          //     h(
          //         'a',
          //         {
          //           style: {
          //             display: this.hasPermission(this, 'edit') ? 'inline-block' : 'none'
          //           },
          //           on: {
          //             click: () => {
          //               this.edit(params.row);
          //             }
          //           }
          //         },
          //         '编辑'
          //     ),
          //     h('Divider', {
          //       props: {
          //         type: 'vertical'
          //       }
          //     }),
          //     h(
          //         'a',
          //         {
          //           style: {
          //             display: this.hasPermission(this, 'delete') ? 'inline-block' : 'none'
          //           },
          //           on: {
          //             click: () => {
          //               this.remove(params.row);
          //             }
          //           }
          //         },
          //         '删除'
          //     )
          //   ]);
          // }
        }
      ]),
      fakeLoading: false,
      chooseColumns: [],
      importTableData: [],
      importColumns: [],
      uploadfile: {
        name: ''
      },
      data: [],
      // exportData: [],
      total: 0,
      showRight: true,
      sexList: [],
      mzList: [],
      zzmmList: [],
      xlccList: [],
      gxList: [],
      xzList: [],
      xlList: [],
      xxxsList: [],
      gzkzksbzList: [],
      jtlxrgxList: [],
      pyfsList: [],
      cxsyList: [],
      sfslbList: [],
      knslbList: [],
      zyList: [],
      waol: {},
      importFormView: false,
      importForm: {
        file: null,
        importMode: '1'
      },
      importErrorData: [],
      importErrorCol: [
        {
          title: '身份证号',
          key: 'rowes',
          minWidth: 100
        },
        {
          title: '错误信息',
          key: 'reason',
          minWidth: 100
        },
        {
          title: '详细信息',
          key: 'data',
          minWidth: 100
        }
      ],
      showBatchEditButton: false,
      showBatchEditDrawer: false,
      batchEditConfirmModal: false,
      // 错误的id列表
      batchEditErrorIds: [],
      batchEditSuccessIds: [],
      // 描述信息 哪些被修改了
      batchEditData: [],
      batchEditDesc: [],
      // 文本框
      batchEditInput: '',
      userInfo: {},
      showSelect: false,
      yxmcList: [],
      MajorOptions: [],
      checkboxVal: [
        '姓名','性别','院校名称', '院系名称','专业','身份证号','学历','民族','政治面貌','生源所在地','学制','师范生类别','家庭电话','状态','操作',
      ],
      formTheadOptions:[
        '姓名','届别','院校名称', '院校代码','院系名称','考生号', '学号', '身份证号','性别', '民族','政治面貌','城乡生源', '学历',
        '专业', '专业方向', '学习形式', '培养方式',"定向或委培单位", '生源所在地','学制','入学时间', '毕业时间', '师范生类别', '困难生类别',
        '所在班级','分校名称','是否52贫困县','贫困县所在省', '出生日期', '电子邮箱', 'QQ号码', '所在地区', '家庭地址', '家庭电话','家庭邮编',
        '高职扩招', '家庭联系人','入学前档案所在单位','档案是否转入学校', '入学前户口所在地派出所','户口是否转入学校', '困难群体标记','扩展字段1',
        '扩展字段2','扩展字段3', '扩展字段4', '扩展字段5', '扩展字段6','扩展字段7', '扩展字段8', '扩展字段9','扩展字段10', '创建时间', '状态',
        '操作',
      ],
      checkboxShow:false
    };
  },
  created(){
    this.init();
  },
  methods: {
    allChange(e){
      if  (e){
        this.checkboxVal =this.formTheadOptions
      }else {
        this.checkboxVal =[]
      }
    },
    invertedChange(){
      let result = this.formTheadOptions.filter(item => !this.checkboxVal.includes(item));
      this.checkboxVal = result
      if (result.length && result.length==this.formTheadOptions.length){
        this.checked = true
      }else {
        this.checked =false
      }
    },
    allChanged(e){
      if (e.length && e.length==this.formTheadOptions.length){
        this.checked = true
      }else {
        this.checked =false
      }
    },
    headerModify(index){
      let that = this,arr = []
      this.columns_1.map(item=>{
        this.checkboxVal.map(e=>{
          if (e == item.title){
            arr.push(item)
          }
        })
      })

      this.columns = this.restTableCellWidth(arr)
      this.key = this.key + 1

      this.checkboxShow = false
    },
    handlePermission(type) {
      return this.hasPermission(this, type)
    },

    getCheckShow() {
      this.checkboxShow = true
    },
    columnValue(data, type) {
      if (type == 'sexCode') {
        let dict = this.sexList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'mzCode') {
        let dict = this.mzList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'zzmmCode') {
        let dict = this.zzmmList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'cxsy') {
        let dict = this.cxsyList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'xlCode') {
        let dict = this.xlList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'xxxs') {
        let dict = this.xxxsList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'pyfsCode') {
        let dict = this.pyfsList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'sydCode') {
        let dict = this.areaCodeList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'xz') {
        let dict = this.xzList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'sfslbCode') {
        let dict = this.sfslbList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'knslbCode') {
        let dict = this.knslbList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'sf52pkx') {
        return data == '0' ? '是' : data == '1' ? '否' : ''
      } else if (type == 'szdq') {
        let dict = this.areaCodeList.find(item => item.value == data);
        return dict ? dict.title : ''
      } else if (type == 'knqtbj') {
        return data == '1' ? '是' : data == '0' ? '否' : ''
      }
    },
    getMajor(e) {
      console.log("专业", e);
      this.MajorOptions.push(e);
    },
    getAllYxList() {
      if (this.resource == 1){
        return
      }
      getAllYxManageList().then(res => {
        if (res.success) {
          if (res.result.length == 0) {
            this.$alert('当前暂无院系信息，请到“学校管理-院系信息”处添加院系信息', '提示', {
              confirmButtonText: '确定'
            });
          }
          this.yxmcList = res.result;
        }
      });
    },
    goToHistory() {
      this.$router.push({
        name: 'ImportHistory'
      });
    },
    goToHistoryAndCloseView() {
      this.importPromptVisible = false;
      this.$router.push({
        name: 'ImportHistory'
      });
    },
    // 删除指定生源去向户口户档
    delByLine() {
      let data = {
        ...this.searchForm1
      };
      this.postRequest('/bysPersonInfo/deleteSyAndQxAndHkAndDaByYxCode', data).then(res => {
        if (res.code === 200) {
          this.$Message.success(res.message);
          // 身份证列表清空
          this.searchForm1.collegeName = '';
          this.searchForm1.schoolName = '';
          this.getDataList()
        } else {
          this.$Message.error(res.message);
          this.searchForm1.collegeName = '';
          this.searchForm1.schoolName = '';
        }
      });
    },
    makeData() {
      this.getRequest('/bysPersonInfo/makeData').then(res => {
        if (res.code === 200) {
          this.$Message.success(res.message);
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    makeFakeData() {
      this.fakeLoading = true;
      this.postRequest('/school/doubleElection/zaoJa').then(res => {
        if (res.code === 200) {
          this.fakeLoading = false;
          this.$Message.success(res.message);
        } else {
          this.fakeLoading = false;
          this.$Message.error(res.message);
        }
        this.fakeLoading = false;
      });
    },
    // 导出所选生源信息
    dropExportSelect() {
      let ids = [];
      this.selectList.forEach(function (e) {
        ids.push(e.id)
      });
      this.exportingSelect = true;
      bysPeronInfoDoneExportByIds({ids: ids}).then(res => {
        this.exportingSelect = false;
        // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
        const blob = new Blob([res], {type: 'charset=utf-8'});
        let url = window.URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.style.display = 'none';
        link.href = url;
        link.setAttribute('download', '所选生源信息.xlsx');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link); // 删除节点
        window.URL.revokeObjectURL(url); //释放该 url
      });
    },

    // 批量修改信息
    batchEditPost() {
      // 发送数据
      let data = {
        ...this.batchEditData,
        idCards: this.batchEditSuccessIds.join(',')
      };
      this.postRequest('/bysPersonInfo/batchUpdate', data).then(res => {
        if (res.code === 200) {
          this.$Message.success('修改成功，请手动刷新页面');
          // 关闭modal
          this.batchEditConfirmModal = false;
          // 关闭Drawer
          this.showBatchEditDrawer = false;
          // 身份证列表清空
          this.batchEditInput = '';
        } else {
          this.$Message.error('修改失败');
        }
      });
    },
    async batchEditSubmit() {
      // 拿到身份证号
      let idCardList = this.batchEditInput.split('\n');
      let data = this.$refs.batchEditRef.form;
      try {
        let ids = await this.batchEditCheckId(idCardList);
        let validData = await this.batchEditCheckData(data);

        // 通过coloum拿到key和名称的对应关系
        let keys = Object.keys(validData);
        if (keys.length === 0) {
          this.$Message.error('没有发生变动');
          return;
        }
        let names = keys.map(key => {
          let col = this.columns.find(item => item.key === key) ?? {};
          if (key === 'gxcode') {
            return '院校代码';
          } else if (key === 'gxmc') {
            return '院校名称';
          }
          return col.title ?? key;
        });
        let desc = [];
        keys.map((item, index) => {
          desc.push({
            key: index,
            name: names[index],
            value: validData[item]
          });
        });
        this.batchEditDesc = desc;
        this.batchEditSuccessIds = ids.rightIds;
        this.batchEditData = validData;
        this.batchEditErrorIds = ids.errorIds;
        // 打开确认框
        this.batchEditConfirmModal = true;
      } catch (e) {
        this.$Message.error('输入有误');
        console.error(e);
      }
    },
    batchEditCheckData(data) {
      let keys = Object.keys(data);
      let newData = {};
      keys.forEach(key => {
        if (typeof data[key] === 'string' && data[key] !== '') {
          newData[key] = data[key];
        }
        if (Array.isArray(data[key])) {
          newData[key] = data[key].length > 0 ? data[key] : '';
        }
      });
      return Promise.resolve(newData);
    },
    batchEditCheckId(ids) {
      return new Promise((resolve, reject) => {
        // 检测ids是否是列表
        if (!Array.isArray(ids)) {
          reject('出错了');
        }
        let errorIds = [];
        let rightIds = [];
        ids.forEach(id => {
          if (id.length !== 0) {
            if (id.length !== 18) {
              errorIds.push(id);
            } else {
              rightIds.push(id);
            }
          }
        });
        resolve({errorIds, rightIds});
      });
    },

    // 打开批量修改信息的抽屉
    openBatchEditPanel() {
      this.showBatchEditDrawer = true;
      this.$refs.batchEditRef.sexCodeList = this.sexList;
      this.$refs.batchEditRef.areaCodeList = this.areaCodeList;
      this.$refs.batchEditRef.yxListSelectData = this.yxList;
      // this.$refs.batchEditRef.yxList = this.yxList;
      this.$refs.batchEditRef.mzList = this.mzList;
      this.$refs.batchEditRef.zzmmList = this.zzmmList;
      this.$refs.batchEditRef.xlccList = this.xlccList;
      this.$refs.batchEditRef.gzkzksbzList = this.gzkzksbzList;
      this.$refs.batchEditRef.jtlxrgxList = this.jtlxrgxList;
      this.$refs.batchEditRef.xlList = this.xlList;
      this.$refs.batchEditRef.zyList = this.zyList;
      this.$refs.batchEditRef.xzList = this.xzList;
      this.$refs.batchEditRef.cxsyList = this.cxsyList;
      this.$refs.batchEditRef.xxxsList = this.xxxsList;
      this.$refs.batchEditRef.pyfsList = this.pyfsList;
      this.$refs.batchEditRef.sfslbList = this.sfslbList;
      this.$refs.batchEditRef.knslbList = this.knslbList;
      this.$refs.batchEditRef.form = {};
    },
    changeIdcard(dataString) {
      let dataRow = JSON.parse(dataString);
    },

    handleExportErrData() {
      let data = this.importErrorData;
      data = data.map(item => {
        return {
          rowes: item.rowes,
          reason: item.reason,
          data: item.data
        };
      });
      const wb = XLSX.utils.book_new();
      data = [{rowes: '身份证号', reason: '错误信息', data: '详细信息'}, ...data];

      const ws = XLSX.utils.json_to_sheet(data, {skipHeader: true});
      XLSX.utils.book_append_sheet(wb, ws, '错误信息');
      XLSX.writeFile(wb, '错误信息.xlsx');
    },
    handleImportSuccess(message, data) {
      this.importPromptVisible = true;
      this.tipMessage_2 = message;
      this.importErrorData = data;
      this.$emit('stop_loop_req');
      this.type = 'success';
      this.tipMessage = '';
      this.importing = false; // 按钮状态
    },

    handleDialogClose(done) {
      // 在这里要停止轮询
      this.$emit('stop_loop_req');
      this.tipMessage_2 = '\t';

      this.importFormcCncel(); // 清空input表单 关闭导入框
      this.getDataList(); // 获取数据

      done();
    },
    tableheig() {
      var bbb = document.getElementsByClassName('calc-px-height')[0].scrollHeight;
      var aaa = document.getElementsByClassName('calc-px-height')[0].children[0].children[0].children[1];
      var ccc = document.getElementsByClassName('calc-px-height')[0].children[0].children[0].children[0].scrollHeight;
      var ddd = bbb - ccc;
      aaa.style.height = `${ddd}px`;

      if (this.searchForm.pageSize === 10) {
        this.height1 = 0;
      } else {
        this.height1 = document.getElementsByClassName('calc-px-height')[0].scrollHeight;
        if (this.total < this.searchForm.pageNumber * this.searchForm.pageSize) {
          var r = (this.searchForm.pageNumber - 1) * this.searchForm.pageSize;
          var a = this.total - r;
          var s = a * 43 + 65;
          if (s < this.height1) {
            this.height1 = 0;
          }
        }
      }
      if (this.total < 10) {
        this.height1 = 0;
      }
    },
    async getJtlxrgx() {
      await getJtlxrgx().then(res=>{
        if (res.code==200) {
          this.jtlxrgxList =res.result;
        }
      })
    },
    async getQzkzksbzList(){
      await getQzkzksbzList().then(res=>{
        if (res.code==200) {
          this.gzkzksbzList =res.result;
        }
      });
    },
    init() {
      this.getDataList();
      this.getDictData();
      this.getJtlxrgx()
      this.getQzkzksbzList()
    },
    //TODO 获取数据集合
    async getDictData() {
      const _this = this;
      try{
        const res1 = await _this.postRequest('/areaCode/getAll');
        if (res1.success) {
          _this.areaCodeList = res1.result.map(e => {
            return { value: e.code, title: e.displayName };
          });
        };
      }catch(err){};

      try{
        const res2 = await _this.postRequest('/schoolCode/getAll');
        if (res2.success) {
          _this.yxList = res2.result.map(e => {
            return { value: e.code, title: e.name };
          });
        };
      }catch(err){};

      // 性别
      try{
        const res3 = await getDictDataByType('sex');
        if (res3.success) {
          _this.sexList = res3.result;
        };
      }catch(err){};

      // 民族
      try{
        const res4 = await getDictDataByType('ethnic')
        if (res4.success) {
          _this.mzList = res4.result;
        };
      }catch(err){};

      // 政治面貌
      try{
        const res5 = await getDictDataByType('political');
        if (res5.success) {
          _this.zzmmList = res5.result;
        };
      }catch(err){};

      // 学历层次
      try{
        const res6 = await getDictDataByType('eduLevelType');
        if (res6.success) {
          _this.xlccList = res6.result;
        };
      }catch(err){};

      // 学历
      try{
        const res7 = await getAllXldmzdList();
        if (res7.success) {
          _this.xlList = res7.result.map(el => {
            return {
              value: el.xldm,
              title: el.xl,
              xllxz: el.xllxz
            };
          });
        }
      }catch(err){};

      try{
        const res8 = await getPeronZyApi();
        _this.MajorOptions = res8.result;
      }catch(err){};

      try{
        const res9 = await getByXlAndLevel({ level: '2' });
        if (res9.success) {
          _this.zyList = res9.result.map(el => {
            return {
              xllxz: el.gradLevelDict,
              value: el.profCode + el.title,
              title: el.profCode + el.title,
              zy: el.title,
              zyCode: el.profCode,
              id: el.id
            };
          });
        };
      }catch(err){};

      // 学习形式
      try{
        const res10 = await getDictDataByType('learning-forms');
        if (res10.success) {
          _this.xxxsList = res10.result;
        };
      }catch(err){};

      // 培养方式 training-methods
      try{
        const res11 = await getDictDataByType('training-methods');
        if (res11.success) {
          _this.pyfsList = res11.result;
        };
      }catch(err){};

      // educational-system 学制
      try{
        const res12 = await getDictDataByType('educational-system');
        if (res12.success) {
          _this.xzList = res12.result;
        };
      }catch(err){};

      // educational-system 师范生类别
      try{
        const res13 = await getDictDataByType('sfs_type');
        if (res13.success) {
          _this.sfslbList = res13.result;
        };
      }catch(err){};

      // 城乡生源
      try{
        const res14 = await getDictDataByType('cxsy');
        if (res14.success) {
          _this.cxsyList = res14.result;
        };
      }catch(err){};

      // 困难生类别代码
      try{
        const res15 = await getDictDataByType('difficult-student-category');
        if (res15.success) {
          _this.knslbList = res15.result;
        };
      }catch(err){};

      _this.listLoading = false;
      _this.addBtnLoading = false
    },
    // 显示隐藏右侧区域
    clickShowRight() {
      this.showRight = !this.showRight;
    },
    handleSelectDep(v) {
      this.searchForm.department_id = v;
    },
    changePage(v) {
      this.searchForm.pageNumber = v;
      this.getDataList();
      this.clearSelectAll();
    },
    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.getDataList();
    },
    selectDateRange(v) {
      if (v) {
        this.searchForm.startDate = v[0];
        this.searchForm.endDate = v[1];
      }
    },
    // TODO 表格获取数据
    async getDataList() {
      // this.$set(this,'loading',true);
      // this.$set(this, 'listLoading', true)
      // this.listLoading = true
      let res = await getBysPersonInfoList(this.searchForm);
      res = Object.freeze(res);
      this.listLoading = false
      if (res.success) {
        this.$set(this,'data',res.result.records.map(el => {
          if (el.zyCode)el.zyXsz = (el.zy == null) ? el.zyCode : el.zyCode + el.zy;
          return el;
        }));
        this.$set(this,'total',res.result.total);
      };
      this.headerModify(1)
      this.$set(this,'loading',false);
      // this.$set(this, 'listLoading', false)
    },
    changeOpenSearch() {
      this.openSearch = false;
    },
    handleSearch() {
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 50;
      this.getDataList();
    },
    handleReset() {
      this.$refs.searchForm.resetFields();
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 50;
      this.selectDate = {};
      this.searchForm.startDate = '';
      this.searchForm.endDate = '';
      this.searchForm.knqtbj=''
      // this.$refs.dep.clearSelect();
      this.searchForm.department_id = '';
      // 重新加载数据
      this.getDataList();
    },
    changeSort(e) {
      this.searchForm.sort = e.key;
      this.searchForm.order = e.order;
      if (e.order == 'normal') {
        this.searchForm.order = '';
      }
      this.getDataList();
    },
    //重置用户密码
    dropReset() {
      if (this.selectList.length <= 0) {
        this.$Message.warning('您还未选择要重置密码的用户');
        return;
      }
      let isActivate = true;
      this.selectList.forEach(el => {
        if (el.isActivate == 0) {
          isActivate = false;
        }
      });
      if (!isActivate) {
        this.$Message.warning({
          duration: 5,
          content: '选中学生账号存在未激活情况, 不能重置密码!',
          closable: true
        });
        return false;
      }
      this.$refs.checkPass.show();
    },

    resetPass(e, i) {
      this.$Modal.confirm({
        title: '确认重置',
        content: '您确认要重置所选的 ' + this.selectList.length + ' 条用户数据密码为' + i + '吗？',
        loading: true,
        onOk: () => {
          let ids = '';
          this.selectList.forEach(function (e) {
            ids += e.userid + ',';
          });
          ids = ids.substring(0, ids.length - 1);
          resetUserPass({ids: ids, password: i}).then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success('操作成功');
              this.clearSelectAll();
              this.getDataList();
            }
          });
        }
      });
    },
    showDetail(v) {
      // 转换null为""
      for (let attr in v) {
        if (v[attr] == null) {
          v[attr] = '';
        }
      }
      let str = JSON.stringify(v);
      let data = JSON.parse(str);
      this.form = data;
      this.showType = '0';
      this.showValue = true;
      this.showUser = true;
    },
    add() {
      this.showType = '2';
      this.showUser = true;
      this.showValue = true;
      this.openSearch = true;
      this.$refs.addOrEdit.sexCodeList = this.sexList;
      this.$refs.addOrEdit.areaCodeList = this.areaCodeList;
      this.$refs.addOrEdit.yxList = this.yxList;
      this.$refs.addOrEdit.mzList = this.mzList;
      this.$refs.addOrEdit.zzmmList = this.zzmmList;
      this.$refs.addOrEdit.xlccList = this.xlccList;
      this.$refs.addOrEdit.gzkzksbzList = this.gzkzksbzList;
      this.$refs.addOrEdit.jtlxrgxList = this.jtlxrgxList;
      this.$refs.addOrEdit.xlList = this.xlList;
      this.$refs.addOrEdit.zyList = this.zyList;
      this.$refs.addOrEdit.xzList = this.xzList;
      this.$refs.addOrEdit.cxsyList = this.cxsyList;
      this.$refs.addOrEdit.xxxsList = this.xxxsList;
      this.$refs.addOrEdit.pyfsList = this.pyfsList;
      this.$refs.addOrEdit.sfslbList = this.sfslbList;
      this.$refs.addOrEdit.knslbList = this.knslbList;
      this.$refs.addOrEdit.form = {};

    },
    sjclaib(v) {
      this.showRight = true;
      // 转换null为""
      for (let attr in v) {
        if (v[attr] == null) {
          v[attr] = '';
        }
      }
      let str = JSON.stringify(v);
      let data = JSON.parse(str);
      this.form = data;
      this.showType = '1';
      this.showValue = true;
      this.openSearch = true;
      this.showUser = true;
      this.$refs.addOrEdit.sexCodeList = this.sexList;
      this.$refs.addOrEdit.areaCodeList = this.areaCodeList;
      this.$refs.addOrEdit.yxList = this.yxList;
      this.$refs.addOrEdit.mzList = this.mzList;
      this.$refs.addOrEdit.zzmmList = this.zzmmList;
      this.$refs.addOrEdit.xlccList = this.xlccList;
      this.$refs.addOrEdit.gzkzksbzList = this.gzkzksbzList;
      this.$refs.addOrEdit.jtlxrgxList = this.jtlxrgxList;
      this.$refs.addOrEdit.xlList = this.xlList;
      this.$refs.addOrEdit.zyList = this.zyList;
      this.$refs.addOrEdit.xzList = this.xzList;
      this.$refs.addOrEdit.cxsyList = this.cxsyList;
      this.$refs.addOrEdit.xxxsList = this.xxxsList;
      this.$refs.addOrEdit.pyfsList = this.pyfsList;
      this.$refs.addOrEdit.sfslbList = this.sfslbList;
      this.$refs.addOrEdit.knslbList = this.knslbList;
      this.$refs.addOrEdit.form = data;

      this.$refs.addOrEdit.handleSelectDataSlice('zyXsz', false);
      this.$refs.addOrEdit.handleSelectDataSlice('szdq', false);
      this.$refs.addOrEdit.handleSelectDataSlice('sydCode', false);
      this.$refs.addOrEdit.handleSelectDataSlice('gxcode', false);
    },
    edit(v) {
      const _this = this;
      clearTimeout(_this.editTimeout);
      if (_this.immediate) {
        _this.immediate = false;
        _this.showType = '1';// 必须作为第一项展示出编辑组件
        _this.$nextTick(() => {
          //立即执行编辑操作
          _this.showValue = true;
          _this.openSearch = true;
          _this.showUser = true;
          let dict = _this.pyfsList.find(item => item.value === v.pyfs_code);
          // 转换null为""
          for (let attr in v) {
            if (v[attr] == null) v[attr] = '';
          };
          let str = JSON.stringify(v);
          let data = JSON.parse(str);
          _this.form = data;
          console.log('呀u四年hi数据', data)
          console.log('dict', _this.jtlxrgxList)
          _this.$refs.addOrEdit.sexCodeList = _this.sexList;
          _this.$refs.addOrEdit.areaCodeList = _this.areaCodeList;
          _this.$refs.addOrEdit.yxList = _this.yxList;
          _this.$refs.addOrEdit.mzList = _this.mzList;
          _this.$refs.addOrEdit.zzmmList = _this.zzmmList;
          _this.$refs.addOrEdit.xlccList = _this.xlccList;
          _this.$refs.addOrEdit.gzkzksbzList = _this.gzkzksbzList;
          _this.$refs.addOrEdit.jtlxrgxList = _this.jtlxrgxList;
          _this.$refs.addOrEdit.xlList = _this.xlList;
          _this.$refs.addOrEdit.zyList = _this.zyList;
          _this.$refs.addOrEdit.xzList = _this.xzList;
          _this.$refs.addOrEdit.cxsyList = _this.cxsyList;
          _this.$refs.addOrEdit.xxxsList = _this.xxxsList;
          _this.$refs.addOrEdit.pyfsList = _this.pyfsList;
          _this.$refs.addOrEdit.sfslbList = _this.sfslbList;
          _this.$refs.addOrEdit.knslbList = _this.knslbList;
          _this.$refs.addOrEdit.form = data;
          _this.$refs.addOrEdit.handleSelectDataSlice('zyXsz', false);
          _this.$refs.addOrEdit.handleSelectDataSlice('szdq', false);
          _this.$refs.addOrEdit.handleSelectDataSlice('sydCode', false);
          _this.$refs.addOrEdit.handleSelectDataSlice('gxcode', false);
          _this.$forceUpdate();
        });
      }
      ;
      _this.editTimeout = setTimeout(() => {
        _this.immediate = true;
      }, 1000);
    },
    enable(v) {
      this.$Modal.confirm({
        title: '确认启用',
        content: '您确认要启用用户 ' + v.idCard + ' ?',
        loading: true,
        onOk: () => {
          enableBysPersonInfo(v.id).then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success('操作成功');
              this.getDataList();
            }
          });
        }
      });
    },
    //导入毕业生数据
    dropImportData() {
      this.importModalVisible = true;
    },
    beforeUploadImport(file) {
      this.importing = true;
      this.submitLoading = true;
      this.uploadfile = file;
      const fileExt = file.name
          .split('.')
          .pop()
          .toLocaleLowerCase();
      if (fileExt == 'xlsx' || fileExt == 'xls' || fileExt == 'dbf' || fileExt == 'zip' || fileExt == 'rar') {
        // if (fileExt == "xlsx" || fileExt == "xls") {
        const formData = new FormData();
        formData.append('file', file);
        // 发送请求给后端
        easyExcelImportData(formData).then(res => {
          if (res.code === 200) {
            this.$Message.success(res.message);
          } else if (res.code === 201) {
            this.$Message.success(res.message);
            const byteArray = Uint8Array.from(atob(res.result), c => c.charCodeAt(0));
            const blob = new Blob([byteArray], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
            // 创建临时 URL 对象
            const url = URL.createObjectURL(blob);
            const downloadLink = document.createElement('a');
            downloadLink.href = url;
            downloadLink.download = '导入失败数据汇总.xlsx'; // 设置文件名
            downloadLink.click();
          } else {
            this.$Message.error(res.message);
            const byteArray = Uint8Array.from(atob(res.result), c => c.charCodeAt(0));
            const blob = new Blob([byteArray], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
            // 创建临时 URL 对象
            const url = URL.createObjectURL(blob);
            const downloadLink = document.createElement('a');
            downloadLink.href = url;
            downloadLink.download = '导入失败数据汇总.xlsx'; // 设置文件名
            downloadLink.click();
          }
          this.submitLoading = false;
          this.importing = false;
          this.getDataList();
        });
        // this.readFile(file);
        // this.file = file;
      } else {
        this.$Notice.warning({
          title: '文件类型错误',
          desc: '所选文件‘ ' + file.name + ' ’不是EXCEL文件、DBF文件、压缩包文件，请选择后缀为.xlsx或者.xls,.dbf,.zip,.rar的文件。'
        });
      }
      return false;
    },
    // 读取文件
    readFile(file) {
      this.reading = true;
      const reader = new FileReader();
      reader.readAsArrayBuffer(file);
      reader.onerror = e => {
        this.reading = false;
        // this.$Message.error("文件读取出错");
        this.$Message.error({
          content: '文件读取出错',
          duration: 5,
          closable: true
        });
      };
      reader.onload = e => {
        const data = e.target.result;
        const {header, results} = excel.read(data, 'array');
        const tableTitle = header.map(item => {
          return {title: item, key: item, minWidth: 130, align: 'center'};
        });
        this.importTableData = results;
        this.importColumns = tableTitle;
        this.reading = false;
        this.$Message.success('读取数据成功');
      };
    },
    clearImportData() {
      this.importTableData = [];
      this.importColumns = [];
      this.uploadfile = {};
    },
    downloadTemple() {
      // 自定义下载模板
      /*let title = [];
let key = [];
userColumns.forEach((e) => {
  title.push(e.title);
  key.push(e.key);
});
const params = {
  title: title,
  key: key,
  data: userData,
  autoWidth: true,
  filename: "导入用户数据模版",
};
excel.export_array_to_excel(params);*/
      // 直接放入excel文件当作模板
      // alert(process.env.BASE_URL + "生源信息导入模板.xlsx", "process.env.BASE_URL + \"用户导入模板.xlsx\"")
      window.location.href = process.env.BASE_URL + '生源信息导入模板.xlsx';
    },
    //导出全部数据
    dropExportAll() {
      this.importing1 = true;
      exportAllPersonInfo().then(res => {
        this.importing1 = false;
        // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
        const blob = new Blob([res], {type: 'charset=utf-8'});
        let url = window.URL.createObjectURL(blob);

        const link = document.createElement('a');
        link.style.display = 'none';
        link.href = url;
        link.setAttribute('download', '生源信息.xlsx');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link); // 删除节点
        window.URL.revokeObjectURL(url); //释放该 url
      });
    },
    importData() {
      let params = this.importTableData.map(item => {
        return {
          jb: item['届别'],
          gxcode: item['所在学校'],
          yxcode: item['所在院系'],
          xy: item['学院'],
          xh: item['学号'],
          name: item['姓名'],
          idCard: item['身份证号'],
          sexCode: item['性别'],
          mzCode: item['民族'],
          zzmmCode: item['政治面貌'],
          xlcc: item['学历层次'],
          xlCode: item['学历代码'],
          xxxs: item['学习形式'],
          zyCode: item['专业代码'],
          mobile: item['手机号'],
          emial: item['电子邮箱'],
          jtdz: item['家庭地址'],
          avatar: 'https://s1.ax1x.com/2018/05/19/CcdVQP.png',
          status: 0,
          delFlag: 0
        };
      });
      this.importLoading = true;
      importBysData(params).then(res => {
        this.importLoading = false;
        if (res.success) {
          this.importModalVisible = false;
          this.getDataList();
          this.$Modal.info({
            title: '导入结果',
            content: res.message
          });
        }
      });
    },
    disable(v) {
      if (!v.isActivate) {
        this.$Message.warning({
          duration: 5,
          content: '该学生账号未激活,不能禁用!',
          closable: true
        });
        return false;
      }
      this.$Modal.confirm({
        title: '确认禁用',
        content: '您确认要禁用用户 ' + v.idCard + ' ?',
        loading: true,
        onOk: () => {
          // v.id = crypto.encrypt(JSON.stringify(v.id))
          disableBysPersonInfo(v.id).then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success('操作成功');
              this.getDataList();
            }
          });
        }
      });
    },
    remove(v) {
      this.$Modal.confirm({
        title: '确认删除',
        loading: true,
        render: (h) => {
          return h('div', [
            h('p', '您确认要删除学生（' + v.idCard + '） ?',),
            h('p', {style: ''}, '注:删除该学生的生源信息，会同步删除该学生的去向填报信息、档案信息和户口信息，请谨慎操作！')
          ]);
        },
        onOk: () => {
          deleteBysPersonInfo({ids: v.id}).then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.clearSelectAll();
              this.$Message.success('删除成功');
              //    this.total : 总数据条数
              //    this.searchForm.pageSize: 每页多少条数据
              //    this.searchForm.pageNumber: 当前页码(当前是哪一页)
              const totalPage = Math.ceil((this.total - 1) / this.searchForm.pageSize);
              this.searchForm.pageNumber = this.searchForm.pageNumber > totalPage ? totalPage : this.searchForm.pageNumber;
              this.searchForm.pageNumber = this.searchForm.pageNumber < 1 ? 1 : this.searchForm.pageNumber;
              this.getDataList();
            }
          });
        }
      });
    },
    dropDown() {
      if (this.drop) {
        this.dropDownContent = '展开';
        this.dropDownIcon = 'ios-arrow-down';
      } else {
        this.dropDownContent = '收起';
        this.dropDownIcon = 'ios-arrow-up';
      }
      this.drop = !this.drop;
    },
    showSelect(e) {
      this.exportData = e;
      this.selectList = e;
    },

    // 困难群体对比
    knComparison() {
      this.$Modal.confirm({
        title: '困难群体对比',
        content: '您确认要执行一次比对任务？ </br>' + '困难群体比对可能需要时间较长, 请耐心等待。</br>',
        loading: true,
        onOk: async () => {
          await compareKnqt().then(res => {
            if (res.code == 200) {
              this.getDataList();
            }
            this.$Message.success(res.message);
          });
          this.$Modal.remove();
        }
      });
    },
    async bysCompareXj() {
      this.$Modal.confirm({
        title: '执行一次',
        content: '您确认要执行一次比对任务？ </br>' + '生源比对可能需要时间较长, 请耐心等待。</br>' + '比对完成将在异动数据模块展示。',
        loading: true,
        onOk: async () => {
          await schoolDoOnce().then(res => {
            if (res.success) {
              this.getDataList();
            }
            this.$Message.success(res.message);
          });
          this.$Modal.remove();
        }
      });
    },
    clearSelectAll() {
      this.$refs.table.clearSelection();
    },
    changeSelect(e) {
      this.selectList = e;
    },
    delAll() {
      if (this.selectList.length <= 0) {
        this.$Message.warning('您还未选择要删除的数据');
        return;
      }
      this.$Modal.confirm({
        title: '确认删除',
        render: (h) => {
          return h('div', [
            h('p', '您确认要删除所选的 ' + this.selectList.length + ' 条数据?',),
            h('p', {style: ''}, '注:删除该学生的生源信息，会同步删除该学生的去向填报信息、档案信息和户口信息，请谨慎操作！')
          ]);
        },
        loading: true,
        onOk: () => {
          let ids = '';
          this.selectList.forEach(function (e) {
            ids += e.id + ',';
          });
          ids = ids.substring(0, ids.length - 1);
          deleteBysPersonInfo({ids: ids}).then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success('删除成功');
              this.clearSelectAll();
              this.getDataList();
            }
          });
        }
      });
    },

    delAllMessage() {
      this.$Modal.confirm({
        title: '确认删除',
        render: (h) => {
          // return h('div', [
          //   h('p', '您确认要清空所有数据吗？')
          // ]);
          return h('div', [
            h('p', '您确认要删除所选的 ' + this.selectList.length + ' 条数据?',),
            h('p', {style: ''}, '注:删除该学生的生源信息，会同步删除该学生的去向填报信息、档案信息和户口信息，请谨慎操作！')
          ]);
        },
        loading: true,
        onOk: () => {
          deleteAllBysPersonInfo().then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success(res.message);
              this.getDataList();
            }
          });
        }
      });
    },

    async importFormOk() {
      if (this.importForm.file == null) {
        this.$Message.info('请选择文件');
        return;
      }
      let formData = new FormData();
      formData.append('importMode', this.importForm.importMode); // 添加参数
      formData.append('file', this.importForm.file);
      this.importing = true;
      easyExcelImportData(formData).then(res => {
        if (res.code === 200) {
          // this.$message.success("导入开始，请前往导入历史查看导入结果信息")
          this.importing = false;
          this.importFormView = false;
          this.tipMessage = "导入正在进行，点击此处或关闭弹窗点击导入历史按钮查看导入结果信息";
          // this.importErrorData = [];
          this.type = 'success';
          this.importPromptVisible = true;
          // // 这里打开了prompt面板 开始轮询
          // let timer = setInterval(() => {
          //   this.postRequest('/history/getHistory').then(res => {
          //     let data = res.result[0]; // 直接取最上面的任务
          //     let {status} = data;
          //     if (status === '1') {
          //       this.handleImportSuccess(data.message, data.importErrorVos);
          //     }
          //   });
          // }, 5000);
          // this.$on('stop_loop_req', () => {
          //   clearInterval(timer);
          //   console.log('停止计时器');
          // });
        }
      });
    },
    importFormcCncel() {
      this.importForm.file = null;
      this.importFormView = false;
    },
    handleUpload(file) {
      const fileExt = file.name
          .split('.')
          .pop()
          .toLocaleLowerCase();
      if (!(fileExt == 'xlsx' || fileExt == 'xls' || fileExt == 'dbf' || fileExt == 'zip' || fileExt == 'rar')) {
        this.$Notice.warning({
          title: '文件类型错误',
          desc: '所选文件‘ ' + file.name + ' ’不是EXCEL文件、DBF文件、压缩包文件，请选择后缀为.xlsx或者.xls,.dbf,.zip,.rar的文件。'
        });
      } else {
        this.importForm.file = file;
      }
      // this.importForm.file = file;
      return false;
    },
    onRestWindow() {
      this.quryLabelWidth = this.searchLabelWidth(80)
      this.addOrEditLabelWidth = this.searchLabelWidth(100)
    }
  },
  mounted() {
    this.onRestWindow()
    window.addEventListener('resize', this.onRestWindow)
    let resource = JSON.parse(Cookies.get('userInfo')).resource;
    this.userInfo = JSON.parse(Cookies.get('userInfo'));
    this.resource = resource
    if (resource === '0') {
      this.showDel = true;
    }
    if (resource === '2') {
      this.showSelect = true;
      this.getAllYxList();
    }

    // 计算高度
    this.height = Number(document.documentElement.clientHeight - 230);
    let roles = JSON.parse(sessionStorage.getItem('roles') || '[]');
    if (Array.isArray(roles)) {
      // ROLE_ADMIN ROLE_PROVINCE ROLE_SCHOOL ROLE_COLLEGE
      if (roles.includes('ROLE_ADMIN') || roles.includes('ROLE_PROVINCE') || roles.includes('ROLE_SCHOOL') || roles.includes('ROLE_COLLEGE')) {
        this.showBatchEditButton = true;
      } else {
        this.showBatchEditButton = false;
      }
    }
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.onRestWindow)
  }
};
</script>
<style>
.message_border {
  margin-bottom: 10px;
}

</style>
<style lang="less" scoped>
@import '../../../styles/table-common.less';
@import '../../personInfo.less';
// /deep/ .ivu-table-body{
//   height: 85.5% !important;
// }
// /deep/ .ivu-table-tip{
//   height: 85.5% !important;
// }
.operation {
  margin-bottom: 0 !important;
  .ivu-btn {
    margin-bottom: .5vh;
  }
}
::v-deep .ivu-drawer-body {
  padding-left: 0;
  padding-right: 0;
}

.tableStyle {
  width: 550px;
  display: flex;
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
  height: 100%; /* 父容器高度，可以根据需要调整 */
}

.cust-modal {
  /deep/ .ivu-modal {
    width: 40% !important;
  }
}

.cust-drawer {
  /deep/ .ivu-drawer {
    width: 30% !important;
  }

  .left-box {
    height: calc(100% - 40px);
    padding-right: 20px;
    padding-left: 20px;
    overflow-y: auto;

    .img-wrapper {
      width: 100%;
      padding-right: 20px
    }

    // .form-box {
    //     width: 300px;
    //     padding-bottom: 10px;
    // }
    .batch-edit {
      margin-left: 10px;
      height: 100%;
      overflow-y: auto;
    }

    .footer {
      border-top: 1 solid #e8eaec;
      padding-top: 10px;

      .f-wrapper {
        justify-content: center;
        // text-align: center;
        margin-left: 350px;
        padding-top: 10px;
        // height: 30px
      }
    }
  }
}

.cmr16 {
  margin-right: 16px;
}

.icon01 {
  background: rgb(45, 154, 244);
  border-radius: 50%;
  padding: 3px
}

.c-drawer01 {
  /deep/ .ivu-drawer {
    width: 1000px !important;
  }
}

@media (max-width: 1920px) {
  /deep/ .ivu-table .ivu-table-fixed-right {
    height: calc(100%) !important;
  }

  /deep/ .ivu-table .ivu-table-fixed-right .ivu-table-fixed-body {
    height: calc(100%) !important;
  }

  /deep/ .ivu-table-body {
    height: calc(100% - 61px) !important;
  }
}

@media (min-width: 1921px) and (max-width: 3440px) {
  /deep/ .ivu-table .ivu-table-fixed-right {
    height: 97% !important;
  }

  /deep/ .ivu-table .ivu-table-fixed-right .ivu-table-fixed-body {
    height: 93% !important;
  }
}
/deep/ .ivu-form-item {
  display: flex;
  align-items: center;
}

// 重构样式
/deep/ .ivu-form-item-label{
  display: flex;
  justify-content: right;
  width: 150px !important;
}
/deep/ .ivu-form-item {
  width: 100%;
  margin-bottom: 0.1rem;
  margin-right: 0 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/deep/ .ivu-form-item-content {
  width: 100% !important;
  margin-left: 0 ! important;
}
/deep/ .ivu-select {
  width: 100% !important;
}
/deep/ .ivu-date-picker {
  width: 100% !important;
}
/deep/ .br {
  margin-top: 15px;
  bottom: 0.12rem !important;
  .ivu-form-item-content {
    display: flex;
  }
}
/deep/ .ivu-input-type-textarea,/deep/ .ivu-input {
  height: calc(100% - 7px) !important;
}
.flex-1 {
  height: 100%;
}
/deep/ .ivu-drawer-body {
  overflow: hidden;
  .d-flex-align-center {
    height: fit-content !important;
    margin-left: 0 !important;
    justify-content: right;
    box-sizing: border-box;
    padding-right: 7px;
  }
}
.box-key {
  /deep/ .ivu-form-item-content {
    margin-left: 100px !important;
  }
}
</style>